import { PathFinderManager } from "../PathFinderManager";
import { ACostDecorate } from "./ACostDecorate";

/**
 * 设置承受伤害
 */
export class ACreepSetDamageIngoreBlock extends ACostDecorate
{
    decorate(manager:PathFinderManager,roomName: string, costs: CostMatrix,opt:IPathFinderOpt): CostMatrix 
    {
        if(!opt.ingoreDamage)
        {
            return costs
        }
        const station = global.world.PollHostiles(roomName);
        if(station )
        {
            for(let x in station.hostileDamageMap)
            {
                for(let y in station.hostileDamageMap[x])
                {
                    if(station.hostileDamageMap[x][y]>=opt.ingoreDamage)
                    {
                        costs.set(parseInt( x),parseInt(y),0xff);
                    }
                }
            }
        }
        return  costs
    }

}